package com.sec.otc.odbc.service.impl;

import com.sec.otc.odbc.config.TableConfig;
import com.sec.otc.odbc.dao.OdbcDataMapper;
import com.sec.otc.odbc.model.OdbcDataParam;
import com.sec.otc.odbc.service.OdbcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class OdbcServiceImpl implements OdbcService {
    @Autowired
    private OdbcDataMapper odbcData;
    @Autowired
    private TableConfig tableConfig;//表配置
    @Override
    public List<Map<String, Object>>  queryData() {
        OdbcDataParam param=new OdbcDataParam();
        Map<String, List<String>> table= tableConfig.getMap();
        for(Map.Entry<String,List<String>> entry:table.entrySet()){
            param.setTableName(entry.getKey());
            param.setFieldNames(entry.getValue());
            param.setLimitRow(tableConfig.getLimitRowMap().get(entry.getKey()));
            param.setOrderField("id");

        }


      //  tableConfig.get
        List<Map<String, Object>> data= odbcData.selectTableData(param);
        return data;

    }
}
